package com.lncg.entity;

import java.time.LocalDateTime;

/**
 * 业务端口配置实体类
 * 
 * 用于管理TCP服务器的端口配置信息，包括业务名称、端口号、运行状态等。
 * 支持通过数据库动态配置端口业务，实现端口的启用/禁用和运行状态管理。
 * 
 * @author LNCG
 * @version 1.2.0
 * @since 2024-10-17
 */
public class BusinessPortConfig {
    
    /** 主键ID，自增长 */
    private Long id;
    
    /** 业务名称，用于标识端口的业务用途 */
    private String businessName;
    
    /** 监听端口号，TCP服务器监听的端口 */
    private Integer port;

    /** 协议类型：92BYTE/CQZL/JSON */
    private String protocolType;
    
    /** 运行状态：1-运行中，0-已停止 */
    private Integer isRunning;
    
    /** 业务描述，详细说明端口的用途 */
    private String description;
    
    /** 启用状态：1-启用，0-禁用 */
    private Integer status;
    
    /** 创建者，记录创建此配置的用户 */
    private String createBy;
    
    /** 创建时间 */
    private LocalDateTime createTime;
    
    /** 更新者，记录最后更新此配置的用户 */
    private String updateBy;
    
    /** 更新时间 */
    private LocalDateTime updateTime;

    /**
     * 默认构造函数
     */
    public BusinessPortConfig() {}

    /**
     * 带参数的构造函数
     * 
     * @param businessName 业务名称
     * @param port 端口号
     */
    public BusinessPortConfig(String businessName, Integer port) {
        this.businessName = businessName;
        this.port = port;
        this.status = 1; // 默认启用
        this.isRunning = 0; // 默认停止
    }

    // ==================== Getter和Setter方法 ====================
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getBusinessName() {
        return businessName;
    }

    public void setBusinessName(String businessName) {
        this.businessName = businessName;
    }

    public Integer getIsRunning() {
        return isRunning;
    }

    public void setIsRunning(Integer isRunning) {
        this.isRunning = isRunning;
    }

    public Integer getPort() { return port; }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getProtocolType() {
        return protocolType;
    }

    public void setProtocolType(String protocolType) {
        this.protocolType = protocolType;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "BusinessPortConfig{" +
                "id=" + id +
                ", businessName='" + businessName + '\'' +
                ", port=" + port +
                ", isRunning=" + isRunning +
                ", description='" + description + '\'' +
                ", status=" + status +
                ", createBy='" + createBy + '\'' +
                ", createTime=" + createTime +
                ", updateBy='" + updateBy + '\'' +
                ", updateTime=" + updateTime +
                '}';
    }
}
